<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/10/12
  Time: 11:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@page import="java.util.List" %>
<%@page import="java.util.Map" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<html>
<head>
    <title>用户通知界面</title>
    <title>管理员通知</title>
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/readeradmin.css">
    <link rel="stylesheet" href="/css/booksearch.css">
    <link rel="stylesheet" href="/css/index.css">
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <style type="text/css">
        .fengye{
            border: 1px solid;
            display: inline;
            padding: 8px 16px;
        }

        span{
            color: aliceblue;
        }
        table{

            width: 980px;
        }


        td{

            overflow: hidden;

        }

        #fff{
            float: left;
            margin-left: 50px;
            width:693px;
            height: 44px;
            border: 1px solid black;
            position: relative;
        }

        #sss {
            float: left;
            height: 41px;
            width: 100px;
            text-align: center;
            line-height: 41px;
        }

        #ttt {
            float: left;
            width: 510px;
            height: 41px;
            padding-left: 10px;
            line-height: 41px;
        }

        #iii {
            /* float: right; */
            position: absolute;
            top: 0;
            left: 611px;
            width: 80px;
            height: 41px;
            background-color: #2d241d;
            font-size: 16px;
            color: #fff;
        }
        .tupian img {
            float: right;
            width: 980px;
            height: 465px;
        }

        .minyan {
            float: left;
            width: 100%;
            height: 163px;
            margin-top: 12px;
            background-color: green;
            text-align: center;
            font-size: 20px;
            font-weight: bold;
            line-height: 163px;
            color: #fff;
            background: rgba(0, 0, 0, 0.7);
        }
        .hide{
            display: none;
        }
        .c1{
            position: fixed;
            top:0;
            bottom: 0;
            left:0;
            right: 0;
            background: rgba(0,0,0,.5);
            z-index: 2;
        }
        .c2{
            background-color: white;
            position: fixed;
            width: 400px;
            height: 300px;
            top:50%;
            left: 50%;
            z-index: 3;
            margin-top: -150px;
            margin-left: -200px;
        }
        #receive{
            display: none;
        }
        .anniu{
            width: 70px;
            height: 25px;
            border: 1px solid black;

            font-size: 15px;

        }
    </style>
</head>
<body>

    <%
        String contextPath = request.getSession().getServletContext().getContextPath();
    %>
    <section class="shortcut">
        <div class="w">
            <div class="fl">
                <ul>
                    <li>图书管理系统！&nbsp;</li>
                    <li>
                        <a href="<%=contextPath%>/user/">退出</a>
                        <a href="#" class="style-red">请登录</a>
                    </li>
                </ul>
            </div>
            <div class="fr">
                <ul>


                    <li class="arrow-icon"><a href="aindex.html">联系管理员</a> </li>
                    <li>|</li>
                    <li class="arrow-icon"> <a href="login.html">关于图书馆</a></li>
                </ul>
            </div>
        </div>
    </section>
    <header class="header w">
        <!-- logo -->
        <div class="logo">
            <h1>
                <a href="index.html" title="图书管理系统">人类进步的阶梯</a>
            </h1>
        </div>



    </header>
    <nav class="nav">
        <div class="w">

            <div class="dropdown">
                <div class="dt"> <a href="index.html">首页</a> </div>
                <div class="dd">
                    <ul>
                        <li><a href="<%=contextPath%>/user/library/">图书馆</a> </li>

                        <li><a href="<%=contextPath%>/user/collect/">我的收藏</a> </li>
                        <li><a href="<%=contextPath%>/user/borrow/">我的借阅</a> </li>
                        <li><a href="<%=contextPath%>/user/personCenter/">我的信息</a> </li>
                        <li><a href="<%=contextPath%>/user/inform/all/">通知</a> </li>

                    </ul>
                </div>
            </div>
            <form id="fff" action="<%=contextPath%>/user/inform/select" method="post" onsubmit="return testEmpty()">
                <label id="sss" >发布人账号:</label>
                <input id="ttt" type="text" name="text" id="text" placeholder="请输入账号"/>
                <input  id="iii" type="submit" value="搜索"/><br><br>
            </form>

        </div>
    </nav>
<%--    <form action="<%=contextPath%>/user/inform/select" method="post" onsubmit="return testEmpty()">--%>
            <div class="w">
                <div class="main">
                    <button class="anniu"  onclick="javascrtpt:window.location.href='<%=contextPath%>/user/inform/all/'">all</button>
                    <button class="anniu"  onclick="javascrtpt:window.location.href='<%=contextPath%>/user/inform/public/'">public</button>
                    <button class="anniu"  onclick="javascrtpt:window.location.href='<%=contextPath%>/user/inform/private/'">private</button><br>
                    <table  id="mainTable" align="center " border="1 " cellpadding="1px " cellspacing="2px " width="980px "  ;>
                        <thead class="biaoge ">
                        <tr>
                            <th>通知编号</th>
                            <th>通知类型</th>
                            <th>发布的管理员用户名</th>
                            <th>发布的管理员账号</th>
                            <th>接收的用户名</th>
                            <th>接收的用户账号</th>
                            <th>发布时间</th>
                            <th>发布内容</th>
                        </tr>
                        </thead>

<%--        <th>通知编号</th>--%>
<%--        <th>通知类型</th>--%>
<%--        <th>发布的管理员用户名</th>--%>
<%--        <th>发布的管理员账号</th>--%>
<%--        <th>接收的用户名</th>--%>
<%--        <th>接收的用户账号</th>--%>
<%--        <th>发布时间</th>--%>
<%--        <th>发布内容</th>--%>
        <%
            List<Map<String, Object>> informs = (List<Map<String, Object>>) request.getAttribute("inform");
            if(informs != null){
                for(Map<String,Object>inform : informs){

        %>
        <tr>
            <td><%=inform.get("informId")%></td>
            <td><%=inform.get("informName")%></td>
            <td><%=inform.get("adminName")%></td>
            <td><%=inform.get("azhanghao")%></td>
            <td><%=inform.get("userName")%></td>
            <td><%=inform.get("zhanghao")%></td>
            <td><%=inform.get("sendTime")%></td>
            <td><%=inform.get("information")%></td>
        </tr>
        <%}%>
        <%}%>
    </table><br><br>

                    <div>
                        <li class="fengye"><a onclick="deleteYeshu()"><<</a></li>
                        <li class="fengye">第<label name="yeshu" id="yeshu">${yeshu}</label>页</li>
                        <li class="fengye"><a onclick="addYeshu()">>></a></li>
                    </div>
                </div>
            </div>
                    <div class="w" >
                        <div class="minyan">
                            六经三史，诸子百家，非无可观，皆是为治。
                        </div>
                    </div>
</body>
    <script  type="text/javascript">
        function addYeshu(){
            var yeshu1 = document.getElementById("yeshu");
            var t = $("#search").text();
            window.location.href="<%=contextPath%>/user/inform/${search}/add?yeshu="+yeshu1.innerText;
        }
        function deleteYeshu(){
            var yeshu1 = document.getElementById("yeshu");
            window.location.href="<%=contextPath%>/user/inform/${search}/delete?yeshu="+yeshu1.innerText;
        }
        function testEmpty(){
            var test1 = document.getElementById("text").value;
            var reg=/^[1-9]/;
            if(test1.length > 0 && reg.test(test1)){
                return true;
            }else{
                alert("空，或者为非纯数字")
                return false;
            }
        }
    </script>
</html>
